/**
 * 创建HTML元素
 * @param {string} tagName 
 * @param {Record<string, unknown>} attributes 
 * @param {Node[]} children 
 * @returns {HTMLElement}
 */
export function createElement(tagName, attributes = null, children = null) {
    // 使用document创建元素
    const element = document.createElement(tagName);
    if (attributes) {
        for (const key of Object.keys(attributes)) {
            element.setAttribute(key, String(attributes[key]));
        }
    }
    if (children) {
        for (const item of children) {
            element.appendChild(item);
        }
    }
    return element;
}
